#region

using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema;

#endregion

namespace CuongHanh.Models
{
    [Table("tbl_StyleStone")]
    public class StyleStone : BaseClass1
    {
        [Key]
        [Column(Order = 0)]
        public int StyleId { get; set; }

        [NotMapped]
        public override int Key1
        {
            get
            {
                return StyleId;
            }
        }

        [Key]
        [Column(Order = 1)]
        public int StoneId { get; set; }

        [NotMapped]
        public override int Key2
        {
            get
            {
                return StoneId;
            }
        }

        public double Price { get; set; }

        public string Image { get; set; }

        public int No { get; set; }

        public string Description { get; set; }

        #region Function

        public StyleStone()
        {
        }

        public StyleStone(StyleStone model)
        {
            StyleId = model.StyleId;
            StoneId = model.StoneId;
            Price = model.Price;
            Image = model.Image;
            No = model.No;
            Description = model.Description;
        }

        public void UpdateInfo(StyleStone model)
        {
            StyleId = model.StyleId;
            StoneId = model.StoneId;
            Price = model.Price;
            if(!string.IsNullOrWhiteSpace(model.Image))
                Image = model.Image;
            Description = model.Description;
        }

        #endregion
    }
}
